# scenes/urls.py
from django.urls import path
from . import views

urlpatterns = [
    # 场景管理
    path('scenes', views.create_scene, name='create_scene'),  # POST创建
    path('scenes/all', views.list_scenes, name='list-scenes'),  # GET列表
    path('scenes/<int:scene_id>/move', views.move_scene, name='move_scene'),  # PUT移动场景
    path('scenes/<int:scene_id>', views.scene_detail, name='scene-detail'),  # GET详情/PATCH更新/DELETE删除

    # 场景动作（设备）管理
    path('scenes/<int:scene_id>/devices', views.add_device, name='add-device'),  # POST
    path('scenes/<int:scene_id>/devices/<int:device_id>', views.remove_device, name='remove-device'),  # DELETE
    path('scenes/<int:scene_id>/devices/<int:device_id>/set_state', views.set_device_state, name='set-device-state'),  # POST 设置设备目标状态
    path('scenes/<int:scene_id>/devices/<int:device_id>/delete_state', views.delete_device_state, name='delete-device-state'),  # DELETE 删除设备目标状态
    
    # 触发器管理
    path('triggers/metadata', views.triggers_metadata, name='triggers-metadata'),  # GET
    path('scenes/<int:scene_id>/triggers', views.add_trigger, name='add-trigger'),  # POST
    path('triggers/check-time', views.check_time_trigger, name='check-time-trigger'),  # POST检查时间触发器

    # 优先级与激活
    #path('scenes/<int:scene_id>/priority', views.adjust_priority, name='adjust-priority'),  # PUT
    path('scenes/<int:scene_id>/switch', views.switch_scene, name='switch-scene'),    # POST

    # 当前生效场景
    path('scenes/active', views.active_scene, name='active-scene'),  # GET
]